<?php
class news_post_view extends SClass {

    public function process() {
   
        $user = $this->getUserSecure();
        if ($user) {
            if ($user->getLevel() >= 2) {
        	   $this->assign('autorized', 1);
            }
        }
        try {
            $post = ServiceUtils::GetFactory()->getNewsService()->getNewsByID(
                $this->getArgument('id')
            );
           
            $this->assign('title', $post->getTitle());
            $this->assign('content', $post->getContent());
            $this->assign('postdate', $post->getPostdate());
            $this->assign('urledit', Engine_LinkMaker::GetURLByContentID(
                'news_post_edit', $post->getId()
            ));
            $this->assign('urldelete', Engine_LinkMaker::GetURLByContentID(
                'news_post_delete', $post->getId()
            ));
        } catch (Exception $e) {
            header('Location: /');
        }
    }

}